<html>
<head><meta charset="utf-8"><title>Emit parse warning · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html">Emit parse warning</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200785922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Emit%20parse%20warning/near/200785922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html#200785922">(Jun 13 2020 at 21:12)</a>:</h4>
<p>How do I emit a warning on a parser instance from another module? (Specifically, I'm in the <code>asm!</code> parsing module.)</p>



<a name="200790609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Emit%20parse%20warning/near/200790609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html#200790609">(Jun 13 2020 at 23:31)</a>:</h4>
<p>I tried doing</p>
<div class="codehilite"><pre><span></span><code><span class="n">p</span><span class="p">.</span><span class="n">sess</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">span_diagnostic</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">struct_span_warn</span><span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="n">prev_token</span><span class="p">.</span><span class="n">span</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Duplicate option&quot;</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">emit</span><span class="p">();</span><span class="w"></span>
</code></pre></div>


<p>where <code>p: &amp;mut Parser&lt;'a&gt;</code>, but nothing happened. I also tried emitting an error instead, but still no error was emitted.</p>
<p>Am I missing something?</p>



<a name="200791155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Emit%20parse%20warning/near/200791155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html#200791155">(Jun 13 2020 at 23:47)</a>:</h4>
<p>Oh wow, I just realized why it didn't work: my test code didn't have that issue in it, so the warning wasn't triggered <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="200804035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Emit%20parse%20warning/near/200804035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html#200804035">(Jun 14 2020 at 07:11)</a>:</h4>
<p>Hard-coded warnings are discouraged and should ideally be all replaced with lints or errors.</p>



<a name="200831061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Emit%20parse%20warning/near/200831061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Emit.20parse.20warning.html#200831061">(Jun 14 2020 at 19:57)</a>:</h4>
<p>I'm actually now using an error; I was using a warning because I thought that a breaking change wasn't okay, but it is since I'm working on an unstable feature</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>